/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.veles.circle;

import cz.muni.fi.veles.MapServer;
import cz.muni.fi.veles.MapUtils;
import cz.muni.fi.veles.maps.AbstractMap;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;

/**
 * Abstract class which represents Circle in map
 * @author Jan Ferko
 */
@JsfComponent(
    family=AbstractCircle.COMPONENT_FAMILY,
    type=AbstractCircle.COMPONENT_TYPE,
    renderer = @JsfRenderer(family=AbstractCircle.COMPONENT_TYPE, type="cz.muni.fi.veles.CircleRenderer")
)
public abstract class AbstractCircle extends UIComponentBase{
    public static final String COMPONENT_TYPE = "cz.muni.fi.veles.Circle";
    public static final String COMPONENT_FAMILY = "cz.muni.fi.veles";

    /**
     * Default value: 10000
     * @return  radius of circle
     */
    @Attribute(required=true, defaultValue="10000")
    public abstract Integer getRadius();

    /**
     * 
     * @return  latitude of circle
     */
    @Attribute(required=true)
    public abstract Double getLatitude();

    /**
     * 
     * @return longitude of circle
     */
    @Attribute(required=true)
    public abstract Double getLongitude();

    /**
     * Default value: #FF0000
     * @return stroke color of circle in hexadecimal representation
     */
    @Attribute(defaultValue="#FF0000")
    public abstract String getStrokeColor();

    /**
     * Default value: 1.0
     * Possible values from 0 to 1.0
     * @return stroke opacity of circle
     */
    @Attribute(defaultValue="1.0")
    public abstract Double getStrokeOpacity();

    /**
     * Default value: 4
     * 
     * @return stroke width of circle
     */
    @Attribute(defaultValue="4")
    public abstract Integer getStrokeWidth();

    /**
     * Default value: #FF0000
     * @return fill color of circle in hexadecimal representation
     */
    @Attribute(defaultValue="#FF0000")
    public abstract String getFillColor();

    /**
     * Default value: 0.4
     * Possible values from 0 to 1.0
     * @return fill opacity of circle
     */
    @Attribute(defaultValue="0.4")
    public abstract Double getFillOpacity();

    /**
     * Map return used map server
     * @return used map server
     */
    public MapServer resolveMapServer(){
        return MapUtils.resolveMapServer(this);
    }
}
